package com.itheimatest;
import java.util.Random;
public class Demo02 {
    public static void main(String[] args) {
        Random r = new Random();
        System.out.println("数组中的数据为");
        int[] array = new int[6];
        for (int i = 0; i < array.length; i++) {
            array[i]=r.nextInt(10)+1;
            System.out.print(array[i] + " ");
        }
        int max = array[0];
        int min = array[0];
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            if(max<array[i]){
                max = array[i];
            }
            if(min>array[i]){
                min = array[i];
            }
            sum += array[i];
        }
        System.out.println();
        System.out.println("最大值为:"+max);
        System.out.println("最小值为:"+min);
        System.out.println("平均数为:"+sum/array.length);
    }
}
